package cn.wdm.ymcc.utils;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;

public class SendEmailUtils {
  /*  {
        JavaMailSender javaMailSender = SpringUtil.getBean(JavaMailSender.class);
    }*/
    public static void sendEmail(String fromEmail,String toEmail,String subject,String text){
        JavaMailSender javaMailSender = SpringUtil.getBean(JavaMailSender.class);
        SimpleMailMessage mailMessage = new SimpleMailMessage();
        //设置发送人
        mailMessage.setFrom(fromEmail);
        //邮件主题
        mailMessage.setSubject(subject);
        //邮件内容
        mailMessage.setText(text);
        //收件人
        mailMessage.setTo(toEmail);
        javaMailSender.send(mailMessage);
    }
}
